package com.apes.autoparts.searcher.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.apes.autoparts.searcher.repository.AutopartsDao;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("epcCommonService")
public class CommonService extends DomainService {

    @Autowired
    AutopartsDao autopartsDao;


    /***
     * 查询配置车型信息
     * @param request
     * @return
     */
    public JSONObject searchVehicleConfig(SimpleRequest request) {
        JSONObject param = request.getJO();
        JSONArray tempArray = autopartsDao.searchVehicleConfig(param);
        if( tempArray != null && tempArray.size() > 0 ) {
            return tempArray.getJSONObject(0);
        } else {
            return new JSONObject();
        }
    }
}
